﻿using Castle.MicroKernel.Registration;
using Castle.Windsor;

using uNhAddIns.ComponentBehaviors.Castle.Configuration;
using Component = Castle.MicroKernel.Registration.Component;
using XWord.Common.Interfaces;
using XWord.Common;
using XWord.Fundamental.Domain;
using XWord.ComponentBehaviors;

namespace XWord.GuyWire.Configurators
{
    public class EntitiesConfigurator : IConfigurator
    {
        public void Configure(IWindsorContainer container)
        {
            //Add the facility

            container.AddFacility<XWordComponentBehaviorsFacility>();
            container.AddFacility<ComponentBehaviorsFacility>();


            container.Register(Component.For<IEntityFactory>()
                                 .ImplementedBy<EntityFactory>()
                                 .LifeStyle.Singleton);

            //container.Register(Component.For<Category>()
            //           .NhibernateEntity()
            //            .AddEditableBehavior()
            //            .AddEditingBehavior()
            //           .AddSelectableBehavior()
            //           .Proxy.AdditionalInterfaces(typeof(IEditingObject))
            //           .AddNotificableBehavior()
            //           .LifeStyle.Transient);

            //container.Register(Component.For<EtymaLibrary>()
            //           .NhibernateEntity()
            //            .AddEditableBehavior()
            //            .AddEditingBehavior()
            //           .AddSelectableBehavior()
            //           .Proxy.AdditionalInterfaces(typeof(IEditingObject))
            //           .AddNotificableBehavior()
            //           .LifeStyle.Transient);

           // container.Register(Component.For<Word>()
           //.NhibernateEntity()
           // .AddEditableBehavior()
           // .AddEditingBehavior()
           //.AddSelectableBehavior()
           //.Proxy.AdditionalInterfaces(typeof(IEditingObject))
           //.AddNotificableBehavior()
           //.LifeStyle.Transient);
        }
    }
}
